package demo;
import java.util.Scanner;

import java.util.Scanner;

public class demo1 {
    public static void main(String[] args) {
         demo1 d1 = new demo1();
        System.out.println("请输入所求阶乘数字：");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        System.out.println("所求数字的阶乘为：");
        System.out.println(d1.sub(num));
    }
    public int sum = 0;
    public int sub(int num) {
        if(num==0||num==1)
            return 1;

        return num*sub(num-1);

    }
}

